package day2;

/**
 * ClassName：Test6
 *
 * @Author：小鱼
 * @Create：2025-08-19 14:49
 */
public class Test6 {
    public static void main(String[] args) {
        Thread thread = new Thread("t1子线程"){
            @Override
            public void run(){
                for (int i = 0; i < 6; i++) {
                    try {
                        if(i==3){
                            Thread.sleep(500);
                        }

                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    System.out.println("i: "+i);
                }
            }

        };
        //获取线程状态
        System.out.println(thread.getState());
        System.out.println(thread.getState());
        thread.start();
        System.out.println(thread.getState());
        System.out.println(thread.getState());
        System.out.println(thread.getState());
        System.out.println(thread.getState());
        System.out.println(thread.getState());
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }


}
